public class Day04 {
    public static void main(String[] args) {
        short a =  3;
        byte b = 1;
        long c = 2;
        Short d = 1;
        Byte e = 3;
//        Long f = 2;//error
        switch (a) {
            case 3:
                System.out.println("ssss");
        }
    }

    // 快乐数
    public boolean isHappy(int n) {
        int slow = getNums(n);
        int fast = getNums(getNums(n));
        if(fast == 1) {
            return true;
        }
        while(slow != fast) {
            if(fast == 1) {
                return true;
            }
            slow = getNums(slow);
            fast = getNums(getNums(fast));
        }

        return false;
    }

    // 得到每个位置上的数字的平方和
    private int getNums(int n) {
        int ret = 0;
        while(n != 0) {
            int num = n % 10;
            ret += num * num;
            n /= 10;
        }
        return ret;
    }

    // 丑数
    public boolean isUgly(int n) {
        if(n == 0) {
            return false;
        }
        int[] arr = {2, 3, 5};
        for(int i = 0; i < arr.length; i++) {
            while(n % arr[i] == 0) {
                n /= arr[i];
            }
        }
        return n == 1;
    }
}
